#ifndef COLORSELECTBUTTON_H
#define COLORSELECTBUTTON_H

#include <QtCore/QObject>
#include <QtCore/QEvent>
#include <QtGui/QWidget>
#include <QtGui/QGraphicsDropShadowEffect>

class ColorSelectButton : public QWidget
{
    Q_OBJECT

private:	// members

    QColor m_color;

private:	// functions

    QGraphicsDropShadowEffect *blurEffect();
    void redraw (QPainter&);

public:

    ColorSelectButton (const QColor & defaultColor, QWidget* parent = 0);
    ~ColorSelectButton ();

    inline QColor& color () { return m_color; }
    void setColor (const QColor& color);

    // events
    void paintEvent (QPaintEvent*);
    void mousePressEvent (QMouseEvent *);
    void mouseReleaseEvent (QMouseEvent *);
    void enterEvent (QEvent*) { update (); }
    void leaveEvent (QEvent*) { update (); }

signals:

    void colorChanged (const QColor& newColor);

};

#endif // COLORSELECTBUTTON_H
